<style scoped src="./index.scss" lang="scss" rel="stylesheet/scss"></style>
<template src="./index.html"></template>
<script>
export default {
  mixins: [Vue.prototype.$vFN.Mixins.Base, Vue.prototype.$vFN.Mixins.Edit],
  components: {
    SelectImage: async () =>
      Vue.extend(await Vue.prototype.$vFN.Components.Base.SelectImage()),
  },
  data() {
    return {
      appWindow: window,
      form: {

        // 是否可以线上快递1可以
        send_online: 1,

        // // 是否可以线下自提1可以
        send_offline: 1,

        // // 提货地址类型1与本店地址相同
        offline_type: "",

        // // 自提地址(其他地址)
        offline_address: "",
      },
      load: true
    };
  },
  methods: {
    async getData() {
      let res = await this.$vFN.Http.post({
        url: "store/setting/detail",
      }, window)
      this.form.send_online = res.data.send_online;
      this.form.send_offline = res.data.send_offline;
      this.form.offline_type = res.data.offline_type;
      this.form.offline_address = res.data.offline_address;
      if(res._ok) {
        this.load = false;
      }
    },
    async init() {
      this.getData();
    },
    async sum() {
      this.load = true;
      let res = await this.$vFN.Http.post({
        url: "store/setting/send",
        data: this.form
      }, window);
      if(res._ok) {
        this.getData();
        this.load = false;
        this.$vFN.Tools.messageSuccess("操作成功");
      }
    }
  },
  mounted() {
    this.init();
  },
  activated() {},
};
</script>